<?php
class Training_LoadContentController extends Zendvn_Controller_Action{
	
	protected $_arrParam;
	protected $_currentController;
	protected $_actionMain;
	protected $_paginator = array(
									'itemCountPerPage' => 5,
									'pageRange' => 3,
								  ); 
	protected $_namespace;
	
	public function init(){
		$this->_paginator['currentPage'] = $this->_request->getParam('page',1);
		$this->_arrParam = $this->_request->getParams();
		$this->_currentController = '/' . $this->_arrParam['module'] . '/' . $this->_arrParam['controller'];
		$this->_actionMain = '/' . $this->_arrParam['module'] . '/' . $this->_arrParam['controller']	. '/index';	
							 
		$this->_arrParam['paginator'] = $this->_paginator;
		
		$this->_namespace = $this->_arrParam['module'] . '-' . $this->_arrParam['controller'];
		$ssFilter = new Zend_Session_Namespace($this->_namespace);
		//$ssFilter->unsetAll();
		if(empty($ssFilter->col)){
			$ssFilter->keywords 	= '';
		}
		$this->_arrParam['ssFilter']['keywords'] 	= $ssFilter->keywords;
		
		//Truyen ra view
		$this->view->arrParam = $this->_arrParam;
		$this->view->currentController = $this->_currentController;
		$this->view->actionMain = $this->_actionMain;
		
		$template_path = TEMPLATE_PATH . "/admin/system";
		$this->loadTemplate($template_path,'template.ini','template');
		
		echo $this->view->headScript()->appendFile(PUBLIC_URL . '/js/jquery-1.4min.js','text/javascript');
	}
	
	public function indexAction(){
		//$tblNewsArticle = new Training_Model_NewsArticle();
		//$this->view->Items = $tblNewsArticle->listItem($this->_arrParam,array('task'=>'list-news-article'));
		$this->_helper->layout->disableLayout();
	}
	
	public function loadScrollAction(){
		$this->_helper->layout->disableLayout();
		$tblNewsArticle = new Training_Model_NewsArticle();
		$this->view->Items = $tblNewsArticle->listItem($this->_arrParam,array('task'=>'list-news-article'));
	}
}
	